package book; //书的相关

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DELL
 * Date: 2022-08-23
 * Time: 21:33
 * name：书架，存放书籍
 */
public class BookList {

    private Book[] books = new Book[10];
    private int countsize;

    public BookList(){
        //书架上原本存有四本书
        books[0] = new Book("三国演义","罗贯中","小说",120);
        books[1] = new Book("西游记","吴承恩","小说",110);
        books[2] = new Book("红楼梦","曹雪芹","小说",150);
        books[3] = new Book("水浒传","施耐庵","小说",130);

        this.countsize = 4;
    }

    public int getCountsize() {
        return countsize;
    }

    public void setCountsize(int countsize) {
        this.countsize = countsize;
    }

    public Book getpos(int pos) {
        //获取书的下标
        return books[pos];
    }

    // Book 虽然被封装 但是无需设置书信息 在BookList中以及进行初始化设置
/*    public void setBooks(Book[] books) {

        this.books = books;
    }*/


    /**
     *
     * @param book  某本书
     * @param pos   指定位置：当前书架上最后一个位置上
     */
    public void setBooks(Book book , int pos){
        books[pos] = book;
    }

}
